/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jsysacc.asistencia.view.gui.asistencia;

import com.cerd.util.BaseSP01.JUtilBaseSP01;
import com.jsysacc.asistencia.model.beans.maestros.MovimientoAsistencia;
import com.jsysacc.asistencia.model.logic.maestros.MovimientoAsistencialLogic;
import com.jsysacc.asistencia.model.logic.maestros.ParametroLogic;
import com.jsysacc.asistencia.view.resources.commons.JLogicInterfaz;
import com.jsysacc.asistencia.view.resources.commons.JTextFieldToUpperCase;
import java.awt.event.KeyEvent;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import org.joda.time.DateTime;

/**
 *
 * @author Carlos
 */
public class FormDialogRegistroAsistencia extends javax.swing.JDialog implements JLogicInterfaz {

    /**
     * Creates new form FormDialogRegistroAsistencia
     */
    public static String hora, minutos, segundos, ampm;
    public static DateTime fechaSis;
    ParametroLogic pLogic = new ParametroLogic();
    MovimientoAsistencialLogic logic = new MovimientoAsistencialLogic();
    JUtilBaseSP01 JUB = JUtilBaseSP01.JUtilBaseSP01;
    private final ResourceBundle rbMensajes = ResourceBundle.getBundle("com.jsysacc.asistencia.view.resources.commons.Mensajes");
    private final ResourceBundle rbMainMenu = ResourceBundle.getBundle("com.jsysacc.asistencia.view.resources.commons.MainMenu");

    public FormDialogRegistroAsistencia(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        initMaster();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jbtnUno = new javax.swing.JButton();
        jbtnDos = new javax.swing.JButton();
        jbtnTres = new javax.swing.JButton();
        jbtnCuatro = new javax.swing.JButton();
        jbtnCinco = new javax.swing.JButton();
        jbtnSeis = new javax.swing.JButton();
        jbtnSiete = new javax.swing.JButton();
        jbtnOcho = new javax.swing.JButton();
        jbtnNueve = new javax.swing.JButton();
        jbtnCero = new javax.swing.JButton();
        jtxtDni = new javax.swing.JTextField();
        jbtnAceptar = new javax.swing.JButton();
        jbtnLimpiar = new javax.swing.JButton();
        jlblHora = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("INTERFAZ DE REGISTRO DE ASISTENCIA");
        setIconImage(null);
        addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                formKeyPressed(evt);
            }
            public void keyReleased(java.awt.event.KeyEvent evt) {
                formKeyReleased(evt);
            }
        });

        jPanel1.setBackground(new java.awt.Color(255, 196, 63));
        jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanel1.setFocusable(false);

        jbtnUno.setFont(new java.awt.Font("Tahoma", 0, 36)); // NOI18N
        jbtnUno.setText("1");
        jbtnUno.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        jbtnUno.setFocusable(false);
        jbtnUno.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnUnoActionPerformed(evt);
            }
        });

        jbtnDos.setFont(new java.awt.Font("Tahoma", 0, 36)); // NOI18N
        jbtnDos.setText("2");
        jbtnDos.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        jbtnDos.setFocusable(false);
        jbtnDos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnDosActionPerformed(evt);
            }
        });

        jbtnTres.setFont(new java.awt.Font("Tahoma", 0, 36)); // NOI18N
        jbtnTres.setText("3");
        jbtnTres.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        jbtnTres.setFocusable(false);
        jbtnTres.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnTresActionPerformed(evt);
            }
        });

        jbtnCuatro.setFont(new java.awt.Font("Tahoma", 0, 36)); // NOI18N
        jbtnCuatro.setText("4");
        jbtnCuatro.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        jbtnCuatro.setFocusable(false);
        jbtnCuatro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnCuatroActionPerformed(evt);
            }
        });

        jbtnCinco.setFont(new java.awt.Font("Tahoma", 0, 36)); // NOI18N
        jbtnCinco.setText("5");
        jbtnCinco.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        jbtnCinco.setFocusable(false);
        jbtnCinco.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnCincoActionPerformed(evt);
            }
        });

        jbtnSeis.setFont(new java.awt.Font("Tahoma", 0, 36)); // NOI18N
        jbtnSeis.setText("6");
        jbtnSeis.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        jbtnSeis.setFocusable(false);
        jbtnSeis.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnSeisActionPerformed(evt);
            }
        });

        jbtnSiete.setFont(new java.awt.Font("Tahoma", 0, 36)); // NOI18N
        jbtnSiete.setText("7");
        jbtnSiete.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        jbtnSiete.setFocusable(false);
        jbtnSiete.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnSieteActionPerformed(evt);
            }
        });

        jbtnOcho.setFont(new java.awt.Font("Tahoma", 0, 36)); // NOI18N
        jbtnOcho.setText("8");
        jbtnOcho.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        jbtnOcho.setFocusable(false);
        jbtnOcho.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnOchoActionPerformed(evt);
            }
        });

        jbtnNueve.setFont(new java.awt.Font("Tahoma", 0, 36)); // NOI18N
        jbtnNueve.setText("9");
        jbtnNueve.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        jbtnNueve.setFocusable(false);
        jbtnNueve.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnNueveActionPerformed(evt);
            }
        });

        jbtnCero.setFont(new java.awt.Font("Tahoma", 0, 36)); // NOI18N
        jbtnCero.setText("0");
        jbtnCero.setFocusable(false);
        jbtnCero.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnCeroActionPerformed(evt);
            }
        });

        jtxtDni.setEditable(false);
        jtxtDni.setBackground(java.awt.SystemColor.inactiveCaption);
        jtxtDni.setColumns(8);
        jtxtDni.setFont(new java.awt.Font("Tahoma", 0, 38)); // NOI18N
        jtxtDni.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jtxtDni.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jtxtDni.setFocusable(false);

        jbtnAceptar.setFont(new java.awt.Font("Tahoma", 0, 36)); // NOI18N
        jbtnAceptar.setText("ACEPTAR");
        jbtnAceptar.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        jbtnAceptar.setFocusable(false);
        jbtnAceptar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnAceptarActionPerformed(evt);
            }
        });

        jbtnLimpiar.setFont(new java.awt.Font("Tahoma", 0, 36)); // NOI18N
        jbtnLimpiar.setText("LIMPIAR");
        jbtnLimpiar.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        jbtnLimpiar.setFocusable(false);
        jbtnLimpiar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnLimpiarActionPerformed(evt);
            }
        });

        jlblHora.setBackground(new java.awt.Color(255, 255, 204));
        jlblHora.setFont(new java.awt.Font("OCR A Extended", 1, 40)); // NOI18N
        jlblHora.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jlblHora.setText("           ");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jbtnUno, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jbtnDos, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jbtnTres, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jbtnCuatro, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jbtnCinco, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jbtnSeis, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jbtnSiete, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jbtnOcho, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jbtnNueve, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jbtnCero, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jtxtDni, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 55, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jlblHora, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jbtnAceptar, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jbtnLimpiar, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(35, 35, 35))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jbtnUno, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jbtnDos, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jbtnTres, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jbtnCuatro, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jbtnCinco, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jbtnSeis, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jlblHora, javax.swing.GroupLayout.PREFERRED_SIZE, 218, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jbtnSiete, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jbtnOcho, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jbtnNueve, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jbtnCero, javax.swing.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE)
                            .addComponent(jtxtDni)))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jbtnAceptar, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jbtnLimpiar, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(22, Short.MAX_VALUE))
        );

        jPanel3.setBackground(new java.awt.Color(204, 51, 0));
        jPanel3.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        jLabel1.setBackground(new java.awt.Color(153, 51, 0));
        jLabel1.setFont(new java.awt.Font("Monotype Corsiva", 1, 50)); // NOI18N
        jLabel1.setForeground(new java.awt.Color(255, 255, 255));
        jLabel1.setText("INGRESE DNI");

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGap(174, 174, 174)
                .addComponent(jLabel1)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        getAccessibleContext().setAccessibleParent(null);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void formKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_formKeyReleased
        // TODO add your handling code here:
        if (evt.getKeyCode() == KeyEvent.VK_0) {
            this.jbtnCero.doClick();
        } else if (evt.getKeyCode() == KeyEvent.VK_1) {
            this.jbtnUno.doClick();
        } else if (evt.getKeyCode() == KeyEvent.VK_2) {
            this.jbtnDos.doClick();
        } else if (evt.getKeyCode() == KeyEvent.VK_3) {
            this.jbtnTres.doClick();
        } else if (evt.getKeyCode() == KeyEvent.VK_4) {
            this.jbtnCuatro.doClick();
        } else if (evt.getKeyCode() == KeyEvent.VK_5) {
            this.jbtnCinco.doClick();
        } else if (evt.getKeyCode() == KeyEvent.VK_6) {
            this.jbtnSeis.doClick();
        } else if (evt.getKeyCode() == KeyEvent.VK_7) {
            this.jbtnSiete.doClick();
        } else if (evt.getKeyCode() == KeyEvent.VK_8) {
            this.jbtnOcho.doClick();
        } else if (evt.getKeyCode() == KeyEvent.VK_9) {
            this.jbtnNueve.doClick();
        }

        if (evt.getKeyCode() == KeyEvent.VK_DELETE) {
            this.jbtnLimpiar.doClick();
        } else if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
            this.jbtnAceptar.doClick();
        }
    }//GEN-LAST:event_formKeyReleased

    private void jbtnUnoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnUnoActionPerformed
        // TODO add your handling code here:
        setEntity("1");
    }//GEN-LAST:event_jbtnUnoActionPerformed

    private void jbtnDosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnDosActionPerformed
        // TODO add your handling code here:
        setEntity("2");
    }//GEN-LAST:event_jbtnDosActionPerformed

    private void jbtnTresActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnTresActionPerformed
        // TODO add your handling code here:
        setEntity("3");
    }//GEN-LAST:event_jbtnTresActionPerformed

    private void jbtnCuatroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnCuatroActionPerformed
        // TODO add your handling code here:
        setEntity("4");
    }//GEN-LAST:event_jbtnCuatroActionPerformed

    private void jbtnCincoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnCincoActionPerformed
        // TODO add your handling code here:
        setEntity("5");
    }//GEN-LAST:event_jbtnCincoActionPerformed

    private void jbtnSeisActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnSeisActionPerformed
        // TODO add your handling code here:
        setEntity("6");
    }//GEN-LAST:event_jbtnSeisActionPerformed

    private void jbtnSieteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnSieteActionPerformed
        // TODO add your handling code here:
        setEntity("7");
    }//GEN-LAST:event_jbtnSieteActionPerformed

    private void jbtnOchoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnOchoActionPerformed
        // TODO add your handling code here:
        setEntity("8");
    }//GEN-LAST:event_jbtnOchoActionPerformed

    private void jbtnNueveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnNueveActionPerformed
        // TODO add your handling code here:
        setEntity("9");
    }//GEN-LAST:event_jbtnNueveActionPerformed

    private void jbtnCeroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnCeroActionPerformed
        // TODO add your handling code here:
        setEntity("0");
    }//GEN-LAST:event_jbtnCeroActionPerformed

    private void jbtnAceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnAceptarActionPerformed
        // TODO add your handling code here:
        JOptionPane.showMessageDialog(this, hora + ":" + minutos + ":" + segundos + " " + ampm);
        //APLICAMOS LA LOGICA
        //
        int h, m, s;
        if (!hayErroresInput()) {
            //OBTENEMOS LA FECHA Y HORA
            h = JUB.toInt(hora);
            m = JUB.toInt(minutos);
            s = JUB.toInt(segundos);
            if (JUB._equiv(ampm, "PM")) {
                h += 12;
            }

            DateTime fecha = new DateTime(fechaSis.getYear(), fechaSis.getMonthOfYear(), fechaSis.getDayOfMonth(), h, m, s);
            String num_ide = JUB.toUpperBlank(this.jtxtDni.getText());
            //buscamos si existe un registro
            try {
                MovimientoAsistencia oMovimientoAsistencia = logic.getByPk(fecha, num_ide);
                if(JUB._vacio(oMovimientoAsistencia)){
                    System.out.println("NO HAY ASISTENCIA REGISTRADA");
                    //VERIFICAMOS LA HORA DE 
                    logic.registrarAsistenciaIngresoMan(fecha, num_ide, "TCRAD001");
                }
            } catch (Exception ex) {
                JOptionPane.showMessageDialog(this, ex.getMessage(), rbMensajes.getString("MSG_MEN_PRI"), 0);
            }
            
        }

    }//GEN-LAST:event_jbtnAceptarActionPerformed

    private void jbtnLimpiarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnLimpiarActionPerformed
        // TODO add your handling code here:

        if (this.jtxtDni.getText().length() > 0) {
            this.jtxtDni.setText(this.jtxtDni.getText().substring(0, this.jtxtDni.getText().length() - 1));
        }

    }//GEN-LAST:event_jbtnLimpiarActionPerformed

    private void formKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_formKeyPressed
        // TODO add your handling code here:

    }//GEN-LAST:event_formKeyPressed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(FormDialogRegistroAsistencia.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(FormDialogRegistroAsistencia.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(FormDialogRegistroAsistencia.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(FormDialogRegistroAsistencia.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the dialog */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                FormDialogRegistroAsistencia dialog = new FormDialogRegistroAsistencia(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    @Override
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JButton jbtnAceptar;
    private javax.swing.JButton jbtnCero;
    private javax.swing.JButton jbtnCinco;
    private javax.swing.JButton jbtnCuatro;
    private javax.swing.JButton jbtnDos;
    private javax.swing.JButton jbtnLimpiar;
    private javax.swing.JButton jbtnNueve;
    private javax.swing.JButton jbtnOcho;
    private javax.swing.JButton jbtnSeis;
    private javax.swing.JButton jbtnSiete;
    private javax.swing.JButton jbtnTres;
    private javax.swing.JButton jbtnUno;
    public static javax.swing.JLabel jlblHora;
    private javax.swing.JTextField jtxtDni;
    // End of variables declaration//GEN-END:variables

    @Override
    public boolean hayErroresInput() {
        String dni_int = JUB.toUpperBlank(this.jtxtDni.getText());
        try {
            //Buscamos si existe
            if (!logic.existePersonalByNum_ide(dni_int)) {
                JOptionPane.showMessageDialog(this, "NO EXISTE EL TRABAJADOR INGRESADO", rbMensajes.getString("MSG_MEN_PRI"), 1);
                return true;
            }

            //Verificamos si es domingo o feriado
            if (logic.getExisteDiaFeriado(fechaSis)) {
                JOptionPane.showMessageDialog(this, "HOY NO SE PUEDE REGISTRAR ES DIA FERIADO", rbMensajes.getString("MSG_MEN_PRI"), 1);
                return true;
            }

            if ((fechaSis.getDayOfWeek() == 7)) {
                JOptionPane.showMessageDialog(this, "NO SE PERMITE REGISTRAR ASISTENCIA EL DOMINGO", rbMensajes.getString("MSG_MEN_PRI"), 1);
                return true;
            }

        } catch (Exception ex) {
            JOptionPane.showMessageDialog(this, ex.getMessage(), rbMensajes.getString("MSG_MEN_PRI"), 0);
        }

        return false;
    }

    @Override
    public void getEntity() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public void setEntity(Object entity) {
        if ((this.jtxtDni.getText() + JUB.toString(entity)).length() <= 8) {
            this.jtxtDni.setText(this.jtxtDni.getText() + JUB.toString(entity));
        } else {
            getToolkit().beep();
        }
    }

    @Override
    public void initMaster() {
        this.jtxtDni.setDocument(new JTextFieldToUpperCase(8, true));
    }

}
